﻿using Mangox.Model.Stock;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static Mangox.Model.Common.EnumComm;

namespace Mangox.Model.Common
{
    /// <summary>
    /// 通用请求对象父类
    /// </summary>
    public class RequestComm
    {
        public string DeviceID { get; set; }

        /// <summary>
        /// 用户登录名
        /// </summary>
        public string LoginName { get; set; }

        public SourceType SourceType { get; set; }

        /// <summary>
        /// 当前页面是否第一次访问，可用于记录某些用户习惯
        /// </summary>
        public bool IsPageFirst { get; set; }

        /// <summary>
        /// 应用版本
        /// </summary>
        public string Versions { get; set; }
        public string Source { get; set; }
        public string Remark { get; set; }

        /// <summary>
        /// 操作系统版本
        /// </summary>
        public string DeviceFamilyVersion { get; set; }

        public string RequestTime
        {
            get
            {
                return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            set { }
        }

    }

    public class PageResult<T> : ResultComm
    {
        public int Count { get; set; }
        public int PageIndex { get; set; }
        public IList<T> Data { get; set; }
    }

    /// <summary>
    /// 分页模型请求
    /// </summary>
    public class CommPageReq
    {
        public CommPageReq()
        {
            Index = 1;
            PageSize = 10;
        }

        /// <summary>
        /// 用户登录名
        /// </summary>
        public string LoginName { get; set; }

        public int Index { get; set; }
        public int sEcho { set; get; }
        public int PageSize { get; set; }

        public SourceType Source { get; set; }


        #region 移动端参数

        /// <summary>
        /// 当前页面是否第一次访问，可用于记录某些用户习惯
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public bool IsPageFirst { get; set; }

        /// <summary>
        /// DeviceID
        /// </summary>
        public string DeviceID { get; set; }

        /// <summary>
        /// 应用版本
        /// </summary>
        public string Versions { get; set; }

        /// <summary>
        /// 页面来源
        /// </summary>
        public string PageSource { get; set; }

        #endregion

    }


    public class NewsReq : CommPageReq
    {
        //审核人..

        public string State { get; set; }
        public string CreateTime { get; set; }
        public string UpdateTime { get; set; }
        public string KeyWord { get; set; }
        public string AdminPubTime { get; set; }
        public string Provenance { get; set; }
        /// <summary>
        /// 文章类型
        /// </summary>
        public ArticleType ArticleType { get; set; }

        /// <summary>
        /// 查询类型
        /// </summary>
        public SearchType SearchType { get; set; }
    }

    /// <summary>
    /// 查询股票代码列表
    /// </summary>
    public class StockPoolReq : CommPageReq
    {
        /// <summary>
        /// 搜索关键字
        /// </summary>
        public string KeyWord { get; set; }


        public int ID { get; set; }

        public string StockCode { get; set; }
        public string StockName { get; set; }

        /// <summary>
        /// 自选股列表
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public List<SelfStockModel> SelfStockList { get; set; }

        /// <summary>
        /// 所属行业
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string AffiIndustry { get; set; }

        /// <summary>
        /// 市场，上海sh，深圳sz
        /// </summary>
        public BazaarType BazaarType { get; set; }

        /// <summary>
        /// 拼音首字母
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string PinYin { get; set; }

        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string State { get; set; }
    }





    /// <summary>
    /// Uwp通用请求
    /// </summary>
    public class CommUwpReq : CommPageReq
    {

    }


}
